<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <title>rainy代码生成</title>
    <link rel="stylesheet"  href="${domain}/css/layui.css" />
    <style>
        .width300{
            width: 300px !important;
        }
        .width100{
            width: 100px !important;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<#include "top.ftl">
<#include "left.ftl">
    <div class="layui-body" >
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <form class="layui-form" action="">
                <input name="id" value="${path.id!}" type="hidden"/>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">数据库</label>
                    <div class="layui-input-inline">
                        <select name="db" lay-filter="aihao">
                        <#list dbs as db>
                            <option value="${db}" <#if path.db! == db>selected</#if>>${db}</option>
                        </#list>
                        </select>
                    </div>
                    <div class="layui-form-mid layui-word-aux">已连数据库${connectDb}</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">标题</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="title" value="${path.title!}" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">*必填</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">基本路径</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="basePackage" value="${path.basePackage!}"  required  lay-verify="required" placeholder="请输入路径" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">*必填</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">entity路径</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="entity" value="${path.entity!}" placeholder="请输入路径" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">dao路径</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="dao" value="${path.dao!}" placeholder="请输入路径" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">service路径</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="service"  value="${path.service!}"  placeholder="请输入路径" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">serviceImpl路径</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="serviceImpl"  value="${path.serviceImpl!}" placeholder="请输入路径" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">controller路径</label>
                    <div class="layui-input-inline width300">
                        <input type="text" name="controller"  value="${path.controller!}" placeholder="请输入路径" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label width100">备注</label>
                    <div class="layui-input-inline width300">
                        <textarea name="description"  placeholder="请输入内容" class="layui-textarea">${path.description!}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label width100">状态</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="state" lay-skin="switch" lay-text="启用|关闭" value="1" <#if path.state! ==1>checked</#if>>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © rainy.com - copy
    </div>
</div>
<script src="${domain}/layui.js"></script>
<script>

    layui.use('form', function(){
        var form = layui.form,
                $=layui.$;

        //监听提交
        form.on('submit(formDemo)', function(data){
            $.post({
                url:"/path/edit",
                type:'post',
                data:data.field,
                success:function(data){
                    if (data.code === 0){
                        layer.confirm('修改成功！', {
                            btn: ['查看列表','稍后'] //按钮
                            ,anim: 1 //动画类型
                        }, function(){
                            location.href ="/path?dbName="+$('#dbSelect option:selected').val();
                        });
                    }
                }
            });
            return false;
        });
    });
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
</script>
</body>
</html>